package com.basic.boot.web.controller;

import com.basic.boot.web.dao.UserMapper;

import com.basic.boot.web.dto.UserDTO;
import com.basic.boot.web.model.User;
import com.basic.boot.web.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author cherrish
 * @time 2019-03-14 16:06
 * @name UserController
 * @desc:
 */
@Slf4j
@RestController
@RequestMapping(value = "/v1/api/user")
public class UserController {

    @Resource
    private UserService userService;

   @GetMapping(value = "/list")
   public Object users(){
       return userService.list();
   }

   @PostMapping(value = "/add")
   public User addUser(@RequestBody UserDTO dto){
        return userService.add(dto);
   }
}
